import {Cartesian3,defined,defineProperties,DeveloperError,EasingFunction,Math,Matrix4} from '@cesiumjs';

// define("FlyOver", ["Cesium/Core/Cartesian3", "Cesium/Core/defined", "Cesium/Core/defineProperties",
//   "Cesium/Core/DeveloperError", "Cesium/Core/EasingFunction", "Cesium/Core/Math", "Cesium/Core/Matrix4"
// ], function(e, t, i, n, r, o, a) {});

var s = function(scene) {
  this._enabled = !1, this._scene = scene, this._locationIndex = 0, this.locations = [
    [-74.01881302800247, 40.69114333714821, 753.2406554180401, 21.27879878293835, -21.343905508724625,
      .0716951918898415
    ],
    [-73.98047884476705, 40.705925841142616, 227.88247802737484, 285.6676771426892, -7.834874548273399,
      359.81474127258133
    ],
    [-73.99896407000593, 40.672300128314426, 1376.6497444488457, 37.64029847881196, -34.00287060239108,
      .1396775247217147
    ],
    [-74.01318744999999, 40.706924436655434, 945.7837942263442, 359.9999999999952, -45.00605958384731,
      360
    ],
    [-74.02219950804052, 40.71147969239071, 603.6030743404027, 78.89921762475097, -42.576383925776085,
      .25356920961873103
    ],
    [-73.96551513671875, 40.78249552669109, 7038.586676420986, 360, -90, 0],
    [-73.98565570000007, 40.74345161121157, 774.8031420859129, 359.99999999999636, -45.00496425369868,
      360
    ],
    [-73.99280919046255, 40.745434282487686, 511.599232484381, 62.86065691763695, -20.43579485236396,
      .18073896378456064
    ],
    [-73.98847204196066, 40.752346490245216, 568.7320340895975, 22.170527697269915, -35.2133174442261,
      .08805136089229587
    ],
    [-73.79600895857718, 40.833031709596206, 586.8892942921019, 35.471016728120546, -21.37790993843282,
      .11871412066123387
    ],
    [-73.99929523035661, 40.760041641946984, 1924.1363440963912, 72.27548446388317, -65.51695915452407,
      .43818878840941416
    ]
  ]
};

Object.defineProperties(s.prototype, {
  scene: {
    get: function() {
      return this._scene
    }
  },
  enabled: {
    get: function() {
      return this._enabled
    },
    set: function(e) {
      this._enabled !== e && (this._scene.camera.cancelFlight(), this._enabled = e, e ? this
        ._flyToNextLocation() : this._disableCamera(!1))
    }
  }
});

s.prototype._disableCamera = function(e) {
  var t = this._scene;
  t.screenSpaceCameraController.enableLook = !e, t.screenSpaceCameraController.enableRotate = !e, t
    .screenSpaceCameraController.enableZoom = !e, t.screenSpaceCameraController.enableTranslate = !e, t
    .screenSpaceCameraController.enableTilt = !e
};

s.prototype._flyToNextLocation = function() {
  this._disableCamera(!0);
  var i = this.locations,
    n = this._locationIndex,
    s = i[n];
  defined(s) || (n = 0, s = i[0]);
  var u = s[0],
    l = s[1],
    c = s[2],
    d = Math.toRadians(s[3]),
    h = Math.toRadians(s[4]),
    f = Math.toRadians(s[5]),
    p = this;
  this.scene.camera.flyTo({
    destination: Cartesian3.fromDegrees(u, l, c),
    orientation: {
      heading: d,
      pitch: h,
      roll: f
    },
    endTransform: Matrix4.IDENTITY,
    duration: 10,
    easingFunction: EasingFunction.QUADRACTIC_IN_OUT,
    maximumHeight: c,
    complete: function() {
      setTimeout(function() {
        p._locationIndex = (n + 1) % i.length, p._enabled && p._flyToNextLocation()
      }, 2500)
    }
  })
};

var FlyOver = s;

export default FlyOver;
